package br.mil.eb.pqrmnt7.scc.entity;

import java.util.Date;

import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.annotations.ForeignKey;

import br.mil.eb.pqrmnt7.scc.entity.controleabastecimento.FluxoCombustivelAdapter;

@MappedSuperclass
public abstract class QuotaCombustivel extends FluxoCombustivelAdapter {
	
	@NotNull
	@Size(max = 1)
	private String sitHistoricoPlc="A";
	
	@Id 
 	@GeneratedValue(strategy=GenerationType.AUTO, generator = "SE_QUOTA_COMBUSTIVEL")
	private Long id;
	
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	private Date dataFornecimento;
	
	@ManyToOne (targetEntity = TipoCombustivelEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name="FK_QUOTACOMBUSTIVEL_TIPOCOMBUSTIVEL")
	@NotNull
	private TipoCombustivel tipoCombustivel;
	
	@ManyToOne (targetEntity = FonteCombustivelEntity.class, fetch = FetchType.LAZY)
	@ForeignKey(name="FK_QUOTACOMBUSTIVEL_FONTECOMBUSTIVEL")
	@NotNull
	private FonteCombustivel fonteCombustivel;
	
	@NotNull
	@Digits(integer=5, fraction=0)
	private Long volume;
	
	@NotNull
	@Size(max = 200)
	private String descricao;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id=id;
	}

	public Date getDataFornecimento() {
		return dataFornecimento;
	}

	public void setDataFornecimento(Date dataFornecimento) {
		this.dataFornecimento=dataFornecimento;
	}
 
	public TipoCombustivel getTipoCombustivel() {
		return tipoCombustivel;
	}

	public void setTipoCombustivel(TipoCombustivel tipoCombustivel) {
		this.tipoCombustivel=tipoCombustivel;
	}

	public FonteCombustivel getFonteCombustivel() {
		return fonteCombustivel;
	}

	public void setFonteCombustivel(FonteCombustivel fonteCombustivel) {
		this.fonteCombustivel=fonteCombustivel;
	}

	public Long getVolume() {
		return volume;
	}

	public void setVolume(Long volume) {
		this.volume=volume;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao=descricao;
	}

	public String getSitHistoricoPlc() {
		return sitHistoricoPlc;
	}

	public void setSitHistoricoPlc(String sitHistoricoPlc) {
		this.sitHistoricoPlc=sitHistoricoPlc;
	}

	@Override
	public Date getData() {
		return this.getDataFornecimento();
	}
	@Override
	public Long getEntrada() {
		return this.getVolume();
	}

	@Override
	public String getObservacao() {
		return this.getDescricao();
	}	
	
}
